<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  </head>
  <body>
<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'north',border:false,split:false" style="overflow:hidden">        
        <form id="query-form2" class="search_form clearfix">
        	<dl>
				<dt>类目名称：</dt>
				<dd>
					<input name="name" id="name" type="text" class="txt" maxlength="16"/>
				</dd>
			</dl>
			<dl>
				<dt>种类：</dt>
				<dd>
                	<select name="type" class="txt grid-10">
						<option value="">请选择</option>
						<option value="1">邻里店</option>
						<option value="2">周边商家</option>
					</select>
				</dd>
			</dl>
			<dl>
				<dt>级别：</dt>
				<dd>
                	<select id="level" name="level" class="txt grid-10" onchange="changeLevel(this.value)">
						<option value="1">一级</option>
						<option value="2">二级</option>
					</select>
				</dd>
			</dl>
			<dl id="dl_parentName" class="hide">
				<dt>上级名称：</dt>
				<dd>
					<input name="parentName" id="parentName" type="text" class="txt" maxlength="16"/>
				</dd>
			</dl>
            <p class="search_form_btn">
            	<input type="button" value="搜索" class="icon_serach" onclick="query()" /></p>
        </form>
    </div>    
	<div data-options="region:'center',border:false">
  		<table id="datagrid2">
			<thead>
				<tr>
					<th data-options="field:'name',width:200,align:'center'">类目名称</th>
					<th data-options="field:'parentName',width:200,align:'center'">上级名称</th>
					<th data-options="field:'status',width:80,align:'center',formatter:formatStatus">状态</th>
					<th data-options="field:'type',width:80,align:'center',formatter:formatType">种类</th>
					<th data-options="field:'oidx',width:80,align:'center'">排序号</th>
					<th data-options="field:'level',width:80,align:'center'">级别</th>
				</tr>
			</thead>
		</table>
    </div>    
</div>
<script type="text/javascript">
	easyui.util.initDatagrid('#datagrid2',{
		singleSelect:false,
		url:'${pageContext.request.contextPath}/mall/shop/category/list'
	});
	
	function query() {
		if(!$('#query-form2').form('validate')) return;
		var data=$('#query-form2').form('jsonObject');
		$('#datagrid2').datagrid('load',data);
		//if(datagrid=='datagrid') $('#query-dialog').dialog('close');
	}
	
	function formatStatus(value,row,index) {
		var l_html = '有效';
		if (value==2) {
			l_html = '失效';
		}
		return l_html;
	}
	function formatType(value,row,index) {
		var l_html = '邻里店';
		if (value==2) {
			l_html = '周边商家';
		}
		return l_html;
	}
	
	function changeLevel(level) {
		if (level == 1) {
			$('#dl_parentName').hide()
			$('#parentName').val('');
		} else {
			$('#dl_parentName').show()
		}
	}
</script>
  </body>
</html>